from django.db import models

class Category(models.Model):
    name=models.CharField(max_length=50)
    parentid=models.ForeignKey("self",null=True,on_delete=models.SET_NULL,related_name="children")
class Book(models.Model):
    name=models.CharField(max_length=50)
    categoryid=models.ForeignKey(Category,on_delete=models.CASCADE,related_name="children1")
    status=models.BooleanField(default=False)
    description=models.TextField(max_length=100,null=True)
    created_at=models.DateTimeField()
    grade=models.IntegerField(choices=[(1,"小学"),(2,"初中"),(3,"高中")])
